<template>
  <div class="main">
    <div class="left">
      <el-form :model="form" style="width: 80%;">
        <el-form-item label="项目名称" label-position="top">
          <el-select
            v-model="selectName"
            @change="changeName($event)"
          >
            <el-option
              v-for="item in form.name"
              :key="item.value"
              :value="item.label"
              :label="item.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="图片颜色" label-position="top">
          <el-color-picker v-model="form.color" />
        </el-form-item>
        <el-form-item label="按钮设置" label-position="top">
          <el-color-picker v-model="form.btn"
        /></el-form-item>
      </el-form>
    </div>
    <div class="right">
      <newPage :name="selectName" :color="form.color" :btn="form.btn" />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import newPage from "./newPage/index.vue";

const form = reactive({
  name: [
    { value: "1", label: "第1个项目名称" },
    { value: "2", label: "第2个项目名称" },
    { value: "3", label: "第3个项目名称" },
  ],
  color: "#21D5BD",
  img: "",
  btn: "#21D5BD",
});

const selectName = ref("第1个项目名称");

const changeName = (e: any) => {
  console.log(e);
  selectName.value = e;
};

// const changeColor = (e:any) => {
//     form.color = e
// }
</script>

<style scoped>
.main {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  width: calc(150vh);
  height: calc(100vh - 20px);
  background-color: aliceblue;
}
.left {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px 0 0 10px;
  margin: 0 20px;
  height: calc(100vh - 20px);
  width: 100%;
}
.right {
  flex: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(50vh);
  border-radius: 10px;
  border: 1px solid black;
  margin: 20px;
  box-shadow: 0 0 5px 1px #999 
}
</style>
